package com.faintlight.config;

import jakarta.validation.constraints.NotBlank;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

import java.util.HashMap;
import java.util.Map;

@ConfigurationProperties(prefix = "wechat.mp")
@Validated
public class WxMpProperties {
    private Map<String, MpConfig> apps = new HashMap<>();

    public Map<String, MpConfig> getApps() {
        return apps;
    }

    public void setApps(Map<String, MpConfig> apps) {
        this.apps = apps;
    }

    public static class MpConfig {
        @NotBlank(message = "AppId 不能为空")
        private String appid;

        @NotBlank(message = "Secret 不能为空")
        private String secret;

        @NotBlank(message = "Token 不能为空")
        private String token;

        private String aesKey;

        public String getAppid() { return appid; }
        public void setAppid(String appid) { this.appid = appid; }
        public String getSecret() { return secret; }
        public void setSecret(String secret) { this.secret = secret; }
        public String getToken() { return token; }
        public void setToken(String token) { this.token = token; }
        public String getAesKey() { return aesKey; }
        public void setAesKey(String aesKey) { this.aesKey = aesKey; }
    }
}
